package com.hnucm.house.adapter;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.hnucm.house.R;
import com.hnucm.house.bean.HomeTop.HomeTop;
import com.hnucm.house.bean.HomeTop.TopResponse;

import java.util.List;

public class HomeTopAdapter extends BaseQuickAdapter<TopResponse.DataDTO, BaseViewHolder> {
    private Context mContext;
    public HomeTopAdapter(List<TopResponse.DataDTO> list, Context context) {
        super(R.layout.item_home_top,list);
        this.mContext = context;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, TopResponse.DataDTO homeTop) {
        baseViewHolder.setText(R.id.tv_home_top,homeTop.getDesc());
//        baseViewHolder.setImageResource(R.id.iv_home_top,R.drawable.ic_calloan);

        Glide.with(mContext)
                .load(R.drawable.ic_manager)
                .fitCenter()
                .centerCrop()
                .into((ImageView) baseViewHolder.getView(R.id.iv_home_top));
//        Glide.with(mContext)
//                .load(mContext.getDrawable(Integer.parseInt(homeTop.getPic())))
//                .fitCenter()
//                .centerCrop()
//                .into((ImageView) baseViewHolder.getView(R.id.iv_home_top));
    }
}
